How can I use '{}' to redirect the output of a command run through find's -exec option?
Posted
by
pkaeding
on Super User
See other posts from Super User
or by pkaeding
Published on 2011-01-10T20:56:20Z
Indexed on
2011/01/10
21:55 UTC
Read the original article
Hit count: 191
I am trying to automate an svnadmin dump
command for a backup script, and I want to do something like this:
find /var/svn/* \( ! -name dir -prune \) -type d -exec svnadmin dump {} > {}.svn \;
This seems to work, in that it looks through each svn repository in /var/svn
, and runs svnadmin dump
on it.
However, the second {}
in the exec command doesn't get substituted for the name of the directory being processed. It basically just results a single file named {}.svn
.
I suspect that this is because the shell interprets >
to end the find
command, and it tries redirecting stdout from that command to the file named {}.svn
.
Any ideas?
© Super User or respective owner